package com.xmu.prcs.entity;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
/**
 *  植物小部位表
 * @author frequent
 *
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "part", uniqueConstraints = @UniqueConstraint(columnNames = "partname"))
public class Part implements Serializable {

	private Integer idPart;
	private String partName;//小部位名
	private Integer isTwoLevel;//是否只有二级特征
	private Set<Feature> features;//部位特征
	
	public Part(){
		
	}
	
	public Part(String partname){
		this.partName = partname;
	}

	@Id
	@GeneratedValue
	@Column(name = "idpart", unique = true, nullable = true)
	public Integer getIdPart() {
		return idPart;
	}

	public void setIdPart(Integer idPart) {
		this.idPart = idPart;
	}

	@Column(name = "partname", length = 10)
	public String getPartName() {
		return partName;
	}

	public void setPartName(String partName) {
		this.partName = partName;
	}

	@OneToMany(cascade = CascadeType.ALL, mappedBy = "part")
	public Set<Feature> getFeatures() {
		return features;
	}

	public void setFeatures(Set<Feature> features) {
		this.features = features;
	}

	@Column(name = "istwolevel")
	public Integer getIsTwoLevel() {
		return isTwoLevel;
	}

	public void setIsTwoLevel(Integer isTwoLevel) {
		this.isTwoLevel = isTwoLevel;
	}
	
}
